package com.acxy.ants.resful.render;

import freemarker.core.Environment;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;

import java.io.IOException;
import java.io.Writer;

/**
 * @author MrShun
 * @version 1.0
 * @Date 2017-05-23
 */
public class FreemarkerException implements TemplateExceptionHandler {

    @Override
    public void handleTemplateException(TemplateException te, Environment env, Writer out) throws freemarker.template.TemplateException {
        try {
            out.write(te.getFTLInstructionStack());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
